package ping
import (
	"fmt"
	"system/ping"
	"model"
	"time"
)

func Run(){
	ip :="www.baidu.com"//"192.168.1.27"//"127.0.0.1"// "192.168.1.27" //IP地址
	var result string
	 job_status:=false
	if job_status=ping.Ping(ip); job_status {
		result=fmt.Sprint("ping ", ip, " ok!")

	}else {
		result = fmt.Sprint("ping ", ip, " fail!")
	}
	j:=&model.UserJob{JobName:"检查计算机",Status:job_status,Desc:result,JobDate:time.Now()}
	//altercenter(j)//报警中心对UserJob进行处理, 一般job_status=false就需要报警了, 还有就是UserJob加一个报警级别吧,
	// 小问题就不要报警了. 报警分多种, 输出到控制台, 输出到email,
	//storagecenter(j)//存储中心对UserJob进行处理, 可以存储到log file, loacl db, remote server
	j.Save()
}

